md5_string_unicode


描述

在密码学中,MD5(Message-Digest algorithm 5,消息摘要算法 5)是广泛使用的具有 128 位散列值的加密散列函数,并且已经在各种安全应用程序中使用。 它也常用于检查文件和字符串的完整性。 此函数将采用输入 unicode 字符串(每个字符为 16 位)并返回该字符串唯一的由 32 个字符组成的十六进制 MD5 散列值。 In this way you can generate a secure key which can be stored and used to check the integrity of the information being sent to (or received from) an external server (for example).

NOTE: There are two formats for the MD5 encoding, UTF-8 and unicode. Both are provided to facilitate communication with different server setups, but the most common to use is unicode.


语法:

md5_string_unicode(string)


参数 描述
string 用于生成 MD5 散列的字符串。


返回:

String(字符串)


例如:

var hash, str;
str = base64_encode(game_data);
hash = md5_string_unicode(str);
http_get("http://www.MacSweeneyGames.com/CatchTheHaggis/gamedata?hash=" + hash); http_get("http://www.MacSweeneyGames.com/CatchTheHaggis/gamedata?data=" + str);

上面的代码将以 base64 格式编码一个字符串,然后生成一个 MD5 散列。 最后,散列和编码的字符串都被发送到服务器。